from sklearn.datasets import load_iris
from sklearn.preprocessing import StandardScaler
from sklearn.neighbors import KNeighborsClassifier

from skLearn.归一化 import transformer

if __name__ == '__main__':
    # 获取鸢尾花数据
    iris = load_iris()
    print(iris.data)
    print(iris.target)
    # 数据标准化
    transformer = StandardScaler()
    x = transformer.fit_transform(iris.data)
    # 模型训练
    estimator = KNeighborsClassifier(n_neighbors=3)
    estimator.fit(x, iris.target)
    # 利用模型进行预测
    result = estimator.predict(x)
    print(result)
